home *** CD-ROM | disk | FTP | other *** search
/ Programmer Power Tools / Programmer Power Tools.iso / progjrn / pj_7_2.arc / PMDEV1.ARC / PMAUX.C < prev    next >
Text File  |  1988-12-03  |  2KB  |  83 lines

  1. /*
  2.  * PMAUX main module
  3.  *
  4.  * Written by Bill Hall
  5.  * 3665  Benton Street, #66
  6.  * Santa Clara, CA 95051
  7.  *
  8.  * See WPMAUX.DOC for usage information
  9.  *
  10.  */
  11.  
  12. #define INCL_PM
  13. #include <os2.h>
  14. #include <stddef.h>
  15. #include <string.h>
  16.  
  17. #include <ttycls.h>
  18. #define EXTERN            /* all globals are declared in this module */
  19. #include "pmaux.h"
  20.  
  21. /* entry point for program */
  22. int cdecl main(int argc, char *argv[])
  23. {
  24.  
  25.     QMSG qmsg;
  26.  
  27.   /* call initialization */
  28.     if (!InitProgram(argc, argv))
  29.     return FALSE;
  30.  
  31.   /* fall into message loop */
  32.     while (WinGetMsg(hAB, (PQMSG)&qmsg, (HWND)NULL, 0, 0))
  33.         WinDispatchMsg( hAB, (PQMSG)&qmsg );
  34.  
  35.   /* program exit */
  36.     WinDestroyWindow(hwndFrame);
  37.     WinDestroyMsgQueue(hmqMsgQ);
  38.     WinTerminate(hAB);
  39. }
  40.  
  41. /* main window message loop */
  42. MRESULT FAR PASCAL MainWndProc(HWND hWnd, USHORT msg, MPARAM mp1, MPARAM mp2)
  43. {
  44.  
  45.     HPS hPS;        /* handle to PM display context */
  46.     RECTL rect;
  47.  
  48.     switch (msg) {
  49.  
  50.     case WM_COMMAND:        /* process menu commands */
  51.         WndCommand(hWnd, LOUSHORT(mp1));
  52.         break;
  53.  
  54.     case WM_USER:        /* process message from calling window */
  55.         DispatchString(hWnd, mp1, mp2);
  56.         break;
  57.  
  58.     case WM_CREATE:        /* called when main window is created */
  59.         WndCreate(hWnd);
  60.         break;
  61.  
  62.     case WM_CLOSE:        /* called when main window is closed */
  63.         SetOS2Ini((HWND)NULL);
  64.             WinPostMsg(hWnd, WM_QUIT, 0L, 0L) ;
  65.             break;
  66.  
  67.        case WM_PAINT:        /* called when window needs repainting */
  68.         hPS = WinBeginPaint(hWnd, (HPS)NULL, (PRECTL)&rect);
  69.         MainWndPaint(hWnd, hPS, (short)rect.yTop, (short)rect.yBottom);
  70.         WinEndPaint( hPS );
  71.             break;
  72.  
  73.         case WM_ERASEBACKGROUND:    /* have PM take care of background */
  74.             return(TRUE);
  75.             break;
  76.  
  77.         default:        /* all other messages go here */
  78.             return( WinDefWindowProc( hWnd, msg, mp1, mp2 ) );
  79.             break;
  80.     }
  81.     return(0L);
  82. }
  83.